namespace WhoCanHelpMe.Web.Controllers.Profile.Mappers
{
    #region Using Directives

    using AutoMapper;

    using Contracts;

    using Domain;

    using ViewModels;

    #endregion

    public class ProfileAssertionViewModelMapper : IProfileAssertionViewModelMapper
    {
        public ProfileAssertionViewModelMapper()
        {
            Mapper.CreateMap<Assertion, ProfileAssertionViewModel>().ForMember(
                viewModel => viewModel.Tag,
                map => map.MapFrom(assertion => assertion.Tag.Name)).ForMember(
                viewModel => viewModel.Category,
                map => map.MapFrom(assertion => assertion.Category.Name));
        }

        public ProfileAssertionViewModel MapFrom(Assertion input)
        {
            return Mapper.Map<Assertion, ProfileAssertionViewModel>(input);
        }
    }
}